using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMCentrosCostos
    {
        public BMCentrosCostos(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private CentrosCostos oEmpleado = new CentrosCostos();
        private List<CentrosCostos> listCentrosCostos = new List<CentrosCostos>();
        private DACentrosCostos daCentrosCostos = new DACentrosCostos();

        #region BMCentrosCostosGetAll
        public List<CentrosCostos> BMCentrosCostosGetAll()
        {
            try
            {
                listCentrosCostos = daCentrosCostos.DACentrosCostosGetAll(connection);
                return listCentrosCostos;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCentrosCostosGetAllActivos
        public List<CentrosCostos> BMCentrosCostosGetAllActivos()
        {
            try
            {
                listCentrosCostos = daCentrosCostos.DAEmpleadosGetAllActicos(connection);
                return listCentrosCostos;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCentrosCostosInsert
        public CentrosCostos BMCentrosCostosInsert(CentrosCostos centro)
        {
            try
            {
                centro = daCentrosCostos.DACentrosCostosInsert(connection, centro);
                return centro;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCentrosCostosUpdate
        public void BMCentrosCostosUpdate(CentrosCostos centro)
        {
            try
            {
                daCentrosCostos.DACentrosCostosUpdate(connection, centro);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCentrosCostoGetOne
        public CentrosCostos BMCentrosCostoGetOne(CentrosCostos centro)
        {
            try
            {
                centro = daCentrosCostos.DACentrosCostosGetOne(connection, centro);
                return centro;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

    }
}

